﻿@model Free2AskWeb.Models.PostModel

 @Html.ValidationSummary(true)
        <fieldset>
            <legend>Post</legend>
            @if (Model != null) { Html.Hidden("PostID", Model.PostID); }
            @if(Model==null||Model.PostType==null||Model.PostType==Free2AskModel.PostType.Question)
            {
                <div class="editor-label">
                    @Html.LabelFor(model => model.Title)
                </div>
                <div class="editor-field">                
                        @Html.EditorFor(model => model.Title)
                        @Html.ValidationMessageFor(model => model.Title)                
                </div>
            }
            <div class="editor-label">
                @Html.LabelFor(model => model.Content)
            </div>
            <div class="editor-field">
                @if(@Model!=null)
                {
                    @Html.RichTextareaFor("Content",@Model.Content)
                }
                else
                {
                    @Html.RichTextareaFor("Content","")
                    //@Html.TextArea("Content","")
                }
                @Html.ValidationMessageFor(model => model.Content)
            </div> 
            @if (Model == null || Model.PostType == null || Model.PostType == Free2AskModel.PostType.Question)
            {    
            <div id="tags">
                Tags: <div id="taglist">
                        @if (Model != null)
                        {
                            foreach (var tag in Model.Tags)
                            {
                                <div class='tag'><div class='tagText'>@tag </div><div class='removeTag'></div></div>
                            }
                        }
                      </div> 
                @Html.TextBox("txtTag")
            </div>
            }
            <div id="author">@if(Model!=null&&Model.AuthorName!=null){<h3>@Model.AuthorName</h3>} Author Info</div>

        </fieldset>

@*<div id="postContainer">
    @Html.Hidden("PostID",Model.PostID)
    
  <div id="title">@if(Model.Title!=null){@Html.TextBox("Title",Model.Title)}</div>
  <div id="postText">
      @Html.RichTextareaFor("Content",@Model.Content)
  </div>
  <div id="author">@if(Model.AuthorName!=null){<h3>@Model.AuthorName</h3>} Author Info</div>
    <input type="submit" value="Save" />
</div>*@